﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.Data
{
    [Serializable]
   public class Scatter3DCollection
    {
        public Scatter3DCollection()
        {
            this._datas = new List<Scatter3D>();
        }


        List<Scatter3D> _datas;

        public List<Scatter3D> Datas
        {
            get { return _datas; }
           
        }
        [field: NonSerialized]
        public event EventHandler<CollecionChangedEventArgs> CollectionChanged;



        int _indexBase=0;

        protected string GetNextId()
        {
            this._indexBase++;

            return "数据" + this._indexBase.ToString();
        }

        #region 公共函数


        public Scatter3D CreateNew()
        {
            Scatter3D scatter = new Scatter3D(this.GetNextId());

            return scatter;
        }



        public void Add(Scatter3D data)
        {
            this._datas.Add(data);

            if (this.CollectionChanged != null)
            {
                this.CollectionChanged(this, new CollecionChangedEventArgs(data, CollectionChangedType.ADD));
            }
        }

        public void Remove(Scatter3D data)
        {
            if (this._datas.Contains(data))
            {
                this._datas.Remove(data);

                if (this.CollectionChanged != null)
                {
                    this.CollectionChanged(this, new CollecionChangedEventArgs(data, CollectionChangedType.REMOVE));

                }

            }
        }


        #endregion
    }
}
